import { CHANGE_NAME } from './action-type'

const initState = {
	name: '张三',
	age: 18
}

const reducer = (state = initState, action) => {
	state = { ...state }
	switch (action.type) {
		case CHANGE_NAME:
			state.name = action.payload.name
			state.age = action.payload.age
			break
	}
	return state
}

// dispatch({
// 	type:'CHANGE_NAME',
// 	payload:{...}
// })

export default reducer